<?php
$this->breadcrumbs=array(
	'Users',
);

$this->menu=array(
	array('label'=>'Create User', 'url'=>array('create')),
	array('label'=>'Manage User', 'url'=>array('admin')),
);
?>

<script type="text/javascript">
<!--
$(function(){
	load();

	$(".portlet-title").click(function(){
		return false;
	});
});

function load(){

	var cstatus = $("#user_status").val();
	var cpage = $("#user_page").val();

	
	var url = '<?php echo $this->createUrl('list',array('rn'=>time()));?>';
	url = url.replace(/<?php echo Yii::app()->urlManager->urlSuffix; ?>/, '/cstatus/'+cstatus+'/cpage/'+cpage+'<?php echo Yii::app()->urlManager->urlSuffix; ?>');

			
	$("#links-detail")
	 .css('background-color','yellow')
	.load(url)
    .css('background-color','white');
	
}


function hoverOverShow(object){

	object.find(".quick").show();
}

function hoverOutHide(object){

	object.find(".quick").hide();
}

function actionShow(object){

	url = object.attr("id");

	alert(url);
	
	$.colorbox({href:url,slideshow:true});

	return false;
}

function actionStatus(object){

	url = object.attr("id");


	$.post(url,function(data){
		if(data == 'ok'){
			load();
		}		
	});

}

function checkAll(object){
	$("input[name=user_item]").each(function(){
		if($(object).attr("checked") == true){
			$(this).attr("checked",true);
		}else{
			$(this).attr("checked",false);
		}
	});
}

function getSelectedInfo(){
    var str = '';
    $("input[name='user_item']").each(function(i){
        if($(this).attr('checked') == true){
            str += ','+$(this).val();
        }
        
    });
    
    //str = str.substr(1,str.length());
    str = str.substring(1);
    arr = str.split(',');
    return arr;
}





//-->
</script>

<div id="detail-info" class="column1" style="width:100%;">
<?php 
	$html = '<input type="checkbox" name="checkAll" onclick="checkAll($(this),\'comment-item\');" value="'.$data->com_id.'" />'.Yii::t('common','Check All').'&nbsp;&nbsp;&nbsp;&nbsp;'.Yii::t('comment' ,'Comment State').'：&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" onclick="actionCommentsBatch();" value="'.Yii::t('admin','Submit').'" />';
?>
<?php 
$news_state = CHtml::dropDownList('user_status','',UArray::arrayMerge(array(''=>Yii::t('user','Group')),User::model()->getUserGroupArray()),array('onchange'=>'load();'));

$page = isset($_GET['page'])?$_GET['page']:'';
$ctype = isset($_GET['ctype'])?$_GET['ctype']:'';
$state = isset($_GET['state'])?$_GET['state']:'';

$html = <<<DOC
   <span>
    	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	{$news_category}
    	&nbsp;&nbsp;
    	{$news_state}	
    	&nbsp;&nbsp;
    	<select name="user_page" id="user_page" onchange="load();">
    		<option value="">每页显示条数</option>
    		<option value="5">5</option>
    		<option value="10">10</option>
    		<option value="15">15</option>
    		<option value="20">20</option>
    	</select>
    	&nbsp;&nbsp;
    	<select name="user_action" onchange="actionBatch($(this));">
    		<option value="">选择操作</option>
    		<option value="delete">删除</option>
    	</select>
    	<button id="action_submit" onclick="load();">确定操作</button>
    	<input type="hidden" id="page" value="{$page}" />
    	<input type="hidden" id="state" value="{$state}" />
    	<input type="hidden" id="category" value="{$category}" />
    </span>
DOC;
?>
	<?php $this->beginWidget('zii.widgets.CPortlet', array('title'=>CHtml::image($this->module->registerImage('article.png'),'Logo', array('width'=>'20'),array('htmlOptions'=>'class="dd"')).'&nbsp;&nbsp;链接列表'.$html,	));?>
	<div class="box">		
		<div class="box-title" style="height:30px;padding-top:5px;margin-top:5px;">
			<div class="left" style="margin-left:25px;width:30px;">
    	
    	<input type="checkbox" name="user_check" onclick="checkAll($(this))" />
    	</div>
			<div class="left" style="width:25%;">链接名称</div>
			<div class="left" style="width:15%;">链接类型</div>
			<div class="left" style="width:45%;">链接描述</div>
		</div>
		<div class="box-content">
			<div id="links-detail">
			
			</div>			
		</div>		
	</div>
	<?php $this->endWidget();?>
</div>

<?php $this->widget('ext.box.colorbox.colorboxWidget',array(
		'id'=>'.user-item-name22',
		'theme'=>'example1',
// 		'options'=>'width:"50%", inline:true,onClosed:function(){ load(); }'
));?> 


